<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
  #frag {
    background-color: #ccc;
    display: block;
    height: 100px;
    position: absolute;
    top: 150px;
    width: 100px;
  }
  #frag:target {
    width: 200px;
  }
</style>
<p>
  Tests that a :target pseudo selector is correctly applied, even when history
  scroll restoration suppresses scrolling to the fragment.
</p>
<div id="console"></div>
<a id="frag" name="frag"></a>
<script>

jsTestIsAsync = true;
if (location.hash == "") {
  runAfterLayoutAndPaint(function() {
    location.hash = 'frag';
    location.reload();
  });
} else {
  runAfterLayoutAndPaint(function() {
    shouldBe(String(document.querySelector("#frag").clientWidth), '200');
    history.back();
    finishJSTest();
  });
}

</script>
